#include "widget.h"

#include <QApplication>
#include"tinyxmlmanager.h"

int main(int argc, char *argv[])
{
    // QApplication a(argc, argv);
    // Widget w;
    // w.show();
    // return a.exec();

    TinyXMLManager xmlManager;
    // // 创建一个 Attendee 实例
    // Attendee attendee;
    // attendee.name = "John Doe";
    // attendee.position = "Developer";
    // attendee.age = 30;
    // attendee.score = 95.5;
    // attendee.success = true;



    // xmlManager.saveXMLElementToXMLFile(attendee,"attendee2.xml");


    // 保存 Attendee 结构体为 XML 文件
    // if (xmlManager.saveAttendeeToXML(attendee, "attendee.xml")) {
    //     std::cout << "XML file saved successfully." << std::endl;
    // } else {
    //     std::cerr << "Failed to save XML file." << std::endl;
    // }


    // 创建一个 Attendee 实例
    // Attendee attendee;
    // // 加载 XML 文件到结构体
    // if (xmlManager.loadAttendeeFromXML(attendee, "attendee.xml")) {
    //     std::cout << "XML file loaded successfully." << std::endl;
    // } else {
    //     std::cerr << "Failed to load XML file." << std::endl;
    //     return 1;
    // }
    // // 打印结构体
    // xmlManager.printAttendee(attendee);



    //创建一个 Meeting 实例
    // Meeting meeting;
    // meeting.where = "Conference Room";
    // meeting.time = 1672531200; // Unix 时间戳
    // Attendee attendee1 = {"John Doe", "Developer", 30, 95.5, true};
    // Attendee attendee2 = {"Jane Smith", "Manager", 40, 88.0, false};
    // meeting.attendees.push_back(attendee1);
    // meeting.attendees.push_back(attendee2);
    // // 保存 Meeting 结构体为 XML 文件
    // if (xmlManager.saveMeetingToXML(meeting, "meeting.xml")) {
    //     std::cout << "XML file saved successfully." << std::endl;
    // }
    // // 加载 XML 文件到 Meeting 结构体
    // Meeting loadedMeeting;
    // if (xmlManager.loadMeetingFromXML(loadedMeeting, "meeting.xml")) {
    //     std::cout << "XML file loaded successfully." << std::endl;
    // }
    // // 打印 Meeting 结构体
    // xmlManager.printMeeting(loadedMeeting);

    // TinyXMLManager manager;
    // std::string filePath = "attendee.xml";
    // // 修改 name 字段
    // if (manager.updateAttendeeInXML(filePath, "Name", "Jane Doe")) {
    //     std::cout << "Name updated successfully." << std::endl;
    // }
    // // 修改 age 字段
    // if (manager.updateAttendeeInXML(filePath, "Age", "18")) {
    //     std::cout << "Age updated successfully." << std::endl;
    // }

    // int value=5;
    int typeInt=1;
    short typeShort=2;
    long typeLong=3;
    long long typeLongLong=4;
    float typeFloat=5.0;
    double typeDouble=6.0;
    bool typeBool=0;
    char typeChar=65;

    cout<<"typeInt:"<<xmlManager.getToString(typeInt)<<endl;
    cout<<"typeShort:"<<xmlManager.getToString(typeShort)<<endl;
    cout<<"typeLong:"<<xmlManager.getToString(typeLong)<<endl;
    cout<<"typeLongLong:"<<xmlManager.getToString(typeLongLong)<<endl;
    cout<<"typeFloat:"<<xmlManager.getToString(typeFloat)<<endl;
    cout<<"typeDouble:"<<xmlManager.getToString(typeDouble)<<endl;
    cout<<"typeBool:"<<xmlManager.getToString(typeBool)<<endl;
    cout<<"typeChar:"<<xmlManager.getToString(typeChar)<<endl;





    return 0;

}
